<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box {
            width: 200px;
            height: 200px;
            background: red;
            padding: 30px;
            border: 5px solid green;
        }
    </style>
</head>
<body>
    <div class="box" style="width: 200px;"></div>
    <script>
        var oBox = document.querySelector(".box");
        console.log(oBox.offsetWidth); //250
        console.log(oBox.style.width);//200px
        // offsetWidth 不可以赋值，只读属性
        // style width height 只能读取行内(内嵌)样式
        oBox.offsetWidth = "400px";
        console.log(oBox.offsetWidth); //270
    </script>
</body>
</html>